const Database = `
type Database {
  name: String!
}
`;

export default () => [Database];

import dbms from '../../dbms';
const data = dbms.database;

export const queryDefs = `
databases(connection: String!): [Database]
tables(connection: String!, database: String!): [Table]
`;

export const queries = {
    databases(_, {connection: name}) {
        return data.get(name).then(
          dbs => dbs.map(name => ({name}))
        );
    },
    tables(_, {connection: conn, database}) {
        return data.tables({conn, db: database}).then(
            tables => tables.map(name => ({name}))
        );
    }
};
